//
//  EatTableViewCell.m
//  项目A --半糖
//
//  Created by romana on 16/5/18.
//  Copyright © 2016年 romana. All rights reserved.
//

#import "EatTableViewCell.h"
#import "UIImageView+WebCache.h"

@implementation EatTableViewCell


-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        [self createSubviews];
        
    }
    return self;
}

-(void)createSubviews
{
    
    self.MyimageView = [[UIImageView alloc] init];
    self.MyimageView.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:self.MyimageView];
    
    self.BigLabel = [[UILabel alloc] init];
    self.BigLabel.backgroundColor = [UIColor whiteColor];
    self.BigLabel.textAlignment = NSTextAlignmentCenter;
    self.BigLabel.layer.borderColor = [[UIColor whiteColor]CGColor];
    
    [self.contentView addSubview:self.BigLabel];
    
    self.SmallLabel = [[UILabel alloc] init];
    self.SmallLabel.backgroundColor = [UIColor whiteColor];
    self.SmallLabel.textAlignment = NSTextAlignmentCenter;
    self.BigLabel.layer.borderColor = [[UIColor whiteColor]CGColor];
    
    [self.contentView addSubview:self.SmallLabel];
    
    
    
}

-(void)layoutSubviews{
    [super layoutSubviews];
    
    self.MyimageView.frame = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height / 5 * 4);
    self.BigLabel.frame = CGRectMake(0, self.frame.size.height / 5 * 4, self.frame.size.width, self.frame.size.height / 10);
    self.SmallLabel.frame = CGRectMake(0, self.frame.size.height / 10 * 9, self.frame.size.width, self.frame.size.height / 10);
    
    
}

-(void)setEatSModel:(EatSecondModel *)EatSModel{

    _EatSModel = EatSModel;
    
    self.BigLabel.text = _EatSModel.title;
    self.SmallLabel.text = _EatSModel.likes;
    [self.MyimageView sd_setImageWithURL:[NSURL URLWithString:_EatSModel.pic]];
    
    
    
}



- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
